package com.niit.service;

import com.niit.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 王铭 20181620310021
 * #Date 2021/6/25 - 23:09
 */

@Service
public class StudentNewService {

    StudentService service;

    @Autowired
    public void setService(StudentService service) {
        this.service = service;
    }

    public List<ExamPaper> getTask(Student student) {
        ExamPaper examPaper = new ExamPaper();
        examPaper.setId_paper(2);
        return service.list((long) student.getId_student());
    }

    public List<StudentPaper> getMyPapers(Student student) {
        return service.selectStudentPaperById(new Long(student.getId_student()));
    }

    public List<StudentPaperQuestionAnswer> viewMyPaper(Integer paperId) {
        return service.selectForPaper(new Long(paperId));
    }

    public List<Classes> myClass(Student student) {
        return  service.getClassById(new Long(student.getId_student()));

    }


    public String quitClass(Integer id, Student student) {
        return service.deleteClassById(new Long(id), new Long(student.getId_student()));
    }


    public String joinClass(Integer id, Student student) {
        return String.valueOf(service.addStudentClassById(new Long(student.getId_student()),new Long(id)));
    }

    public Student login(String uname, String pwd) {
        return service.getStudentById(new Long(2));
    }
}
